/* 
 * Enable button group
 */

$(document).ready(function(){
    $('*[data-role="button-group-header"]').click(function(){
        var $target = $($(this).data('target'));
        if ($target.hasClass('open')) {
            $target.removeClass('open');
        } else {
            $('*[data-role="button-group"]').removeClass('open');
            $target.addClass('open');
        }
    });
    $('*[data-role="button-group-menu"] > *').click(function(){
        $($(this).parent('*[data-role="button-group-menu"]').data('target')).removeClass('open');
    });
});